from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import gettext_lazy as _
from django.core import validators
from fiteat.middleware import threadlocals

UNIT_CHOICES = (
    ('M', _('Metric')),
    ('E', _('English'))
)

class Profile(models.Model):
    user = models.ForeignKey(User, editable=False)
    units_system = models.CharField(max_length=1, choices=UNIT_CHOICES, default='M')

    def save(self):
        self.user = threadlocals.get_current_user()
        super(Profile,self).save()

    class Admin:
        pass
